<template>
  <div class="login-container">
    <div class="content">
      <div class="left"></div>
      <div class="right">
        <div class="login-box">
          <div class="title" v-html="title"></div>
          <div class="login-form">
            <a-form-model
              :model="form"
              @submit="handleSubmit"
              @submit.native.prevent
            >
              <a-form-model-item v-if="regionFlag">
                <a-cascader
                  size="large"
                  v-model="form.unitAreaId"
                  :options="options"
                  placeholder="请先选择地区"
                  change-on-select
                >
                </a-cascader>
                <a-icon class="custom-icon" type="global" />
              </a-form-model-item>
              <a-form-model-item>
                <a-auto-complete
                  size="large"
                  v-model="form.username"
                  style="width: 100%"
                  placeholder="请输入账号"
                  :disabled="readonly"
                  @search="onSearch"
                >
                  <template slot="dataSource">
                    <a-select-option v-for="item in dataSource" :key="item.userName">
                      {{ item.userName }}
                    </a-select-option>
                  </template>
                </a-auto-complete>
                <a-icon class="custom-icon" type="user" />
              </a-form-model-item>
              <a-form-model-item>
                <a-input
                  size="large"
                  v-model="form.password"
                  type="password"
                  placeholder="请输入密码"
                  :disabled="readonly"
                >
                  <a-icon
                    slot="prefix"
                    type="lock"
                    style="color: rgba(0, 0, 0, 0.25)"
                  />
                </a-input>
              </a-form-model-item>
              <a-form-model-item>
                <a-button
                  size="large"
                  type="primary"
                  html-type="submit"
                  style="width: 100%"
                >
                  登录
                </a-button>
              </a-form-model-item>
            </a-form-model>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script lang='ts' src='./index.ts'></script>

<style lang='scss' scoped>
@import "./_index.scss";
</style>